/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.woundedwolf.android.tumbleweed;

import android.graphics.Bitmap;
import android.graphics.Canvas;
import com.woundedwolf.android.tumbleweed.elements.Renderable;
import com.woundedwolf.android.tumbleweed.elements.Vector2D;
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
import java.nio.FloatBuffer;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import javax.microedition.khronos.opengles.GL10;

/**
 *
 * @author zagnut
 */
public class Polygon
{

        private final Object pointLock;
        private ArrayList<Vector2D> polygonList;
        public List<Vector2D> synchronizedPointsList;
        private int type;
        private int color;
        
        public Polygon(int type, int color, List<Vector2D> points)
        {
                this(type, color);
                for(Vector2D point : points)
                {
                        synchronizedPointsList.add(point);
                }
        }

        public Polygon(int type, int color)
        {
                this.color = color;
                this.type = type;
                pointLock = new Object();
                polygonList = new ArrayList<Vector2D>();
                synchronizedPointsList = Collections.synchronizedList(polygonList);
        }

        public int getType()
        {
                return type;
        }

        public int getColor()
        {
                return color;
        }

        public List<Vector2D> getPoints()
        {
                return synchronizedPointsList;
        }

        public void addPoints(List<Vector2D> points)
        {
                for(Vector2D point : points)
                {
                     this.addPoint(point);
                }
        }
        
        public void addPoint(Vector2D point)
        {
                synchronizedPointsList.add(point);
        }

        public void removePoint(Vector2D point)
        {
                synchronizedPointsList.remove(point);
        }
}
